import {
    findLoca,
    getRepairInfo
} from '../../../api/afftersale/repair.js'

let Repair = {
    data() {
        return {
            //树数据
            locationList: [],
            locationInfo: [],

            //树设置
            defaultProps: {
                id: 0,
                label: 'name',
                children: 'children'
            },
            //默认展开数组
            expandedKeys: [1],
        }
    },
    methods: {
        find() {
            findLoca().then(value => {
                let loc = {
                    name: '维修点城市',
                    children: value
                };
                this.locationList.push(loc);
            })
        },

        //点击事件
        handleNodeClick(data) {
            getRepairInfo(data.id).then(value => {
                this.locationInfo = value;
            });
        },

        //时间格式化
        creatFormatter(row) {
            if (row.createTime !== null) {
                return row.createTime.replace("T", " ");
            }
        },
    },
    created() {
        this.find()
    }
};

export default Repair;